//
//  FooterView.m
//  OrderFood
//
//  Created by xiaofang wang on 2018/10/23.
//  Copyright © 2018年 zhiyuan. All rights reserved.
//

#import "FooterView.h"


@implementation FooterView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = WHITECOLOR;
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    self.markLb = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-30, 50)];
    self.markLb.font = FONT(14);
    self.markLb.numberOfLines = 0;
    [self addSubview:self.markLb];
    NSString *markStr = @"备注：不要加辣、不要加葱、不要加香菜、不要加大蒜，请直接放到前台，谢谢！备注：不要加辣、不要加葱、不要加香菜、不要加大蒜，请直接放到前台，谢谢";
    self.markLb.text = markStr;
    CGSize markSize = [QTTools fc_getStringSizeWith:markStr boundingRectWithSize:CGSizeMake(SCREEN_WIDTH-30, 500) font:FONT(14)];
    if (markSize.height > 50) {
        CGRect frame = self.markLb.frame;
        frame.size.height = markSize.height+10;
        self.markLb.frame = frame;
    }
    [QTTools tool_addLineWithFrame:CGRectMake(0, GetMaxY(self.markLb), SCREEN_WIDTH, 1) superView:self];
    
    
    self.leftActionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.leftActionBtn.frame = CGRectMake(SCREEN_WIDTH-193, 9+GetMaxY(self.markLb), 84, 32);
    [self.leftActionBtn setImage:IMAGE(@"ycsb") forState:UIControlStateNormal];
    [self addSubview:self.leftActionBtn];
    
    self.rightActionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.rightActionBtn.frame = CGRectMake(SCREEN_WIDTH-99, GetMinY(self.leftActionBtn), 84, 32);
    [self.rightActionBtn setImage:IMAGE(@"jiedan2") forState:UIControlStateNormal];
    [self addSubview:self.rightActionBtn];
    
    
}
-(void)setState:(OrderState)state{
    if (state == 0) {
        [self.rightActionBtn setImage:IMAGE(@"jiedan2") forState:UIControlStateNormal];
    }else if (state == 1){
        [self.rightActionBtn setImage:IMAGE(@"qrqc2") forState:UIControlStateNormal];
    }
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
